home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part1 / 4066 < prev    next >
Encoding:
Internet Message Format  |  1996-08-06  |  2.3 KB

  1. Path: news1.h1.usa.pipeline.com!usenet
  2. From: grantp@usa.pipeline.com
  3. Newsgroups: comp.lang.c++
  4. Subject: Re: cin.get() function challenge
  5. Date: 27 Jan 1996 16:45:24 GMT
  6. Organization: Kalevi, Inc.
  7. Message-ID: <4edkr4$2mb@news1.usa.pipeline.com>
  8. NNTP-Posting-Host: pipe11.h1.usa.pipeline.com
  9. X-PipeUser: grantp
  10. X-PipeHub: usa.pipeline.com
  11. X-PipeGCOS: (Pete)
  12. X-Newsreader: Pipeline USA v3.3.0
  13.  
  14. On Jan 26, 1996 16:27:40 in article <cin.get() function challenge>,
  15. 'wsenn@cencom.net (Will Senn)' wrote: 
  16.  
  17. >Alrighty then! 
  18. >Some of you may recall my post of a week ago asking for help on getch()
  19. and 
  20. >cin.  The responses I received were not encouraging. 
  21. >The problem: 
  22. >    Write a function in C++ not using getch() that will read in ONE  
  23. >character at a time, without line buffering.  In other words when the user
  24.  
  25. >presses ONE key, take and process that keypress.  I had originally asked
  26. if 
  27. >it was possible to use cin or another iostream for this purpose.  It would
  28. be 
  29. >nice if someone could definitively address this question. 
  30. >The most common reply I received and one the authors claimed would relieve
  31. all 
  32. >my problems, while implying I should read the BOOK was the following: 
  33. ... [code deleted]... 
  34.  
  35. >This is a piece of code that these 'programmers' obviously read in a BOOK,
  36.  
  37. >it doesn't even come close to addressing my question.  If they had
  38. finished 
  39. >the chapter they were reading they might have noticed that the get()
  40. member 
  41. >function of cin is ALWAYS line buffered!  Another way they might have
  42. realized 
  43. >that their answer was wrong would have been to COMPILE it. 
  44. >If someone out there has a grip on this rather complex issue,  I would
  45. very 
  46. >much appreciate a reply, by mail or post. 
  47. I don't know whether you chose to ignore all the correct responses 
  48. to your question or is your newsreader malfunctioning.  I saw at 
  49. least three responses of the nature "it isn't possible with standard 
  50. iostream library as reading keystrokes directly is dependent on the 
  51. OS and/or the compiler system you're using". 
  52. Those answers were more or less correct. 
  53.  
  54. I could offer a solution for a specific platform, but if I recall 
  55. correctly, in your original post you already stated that you 
  56. were already aware of conio or curses library functions that 
  57. will do what you want. 
  58.  
  59. -- 
  60. Pete Grant 
  61. Kalevi, Inc. 
  62. Object Oriented Software Development
  63.